home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 4.9 KB | 161 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWBndStr.cpp
- // Release Version: $ 1.0d11 $
- //
- // Copyright: (c) 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWBNDSTR_H
- #define FWBNDSTR_H
-
- #ifndef FWSTRS_H
- #include "FWStrs.h"
- #endif
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- //========================================================================================
- // CLASS FW_CBoundedString
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CBoundedString : public FW_CString
- {
- public:
-
- FW_DECLARE_CLASS
-
- virtual ~ FW_CBoundedString();
- FW_CBoundedString(FW_ByteCount stringSize, FW_Byte* storagePointer);
- FW_CBoundedString(FW_ByteCount charWidth, FW_ByteCount stringSize, FW_Byte* storagePointer);
-
- FW_CString& operator=(const FW_CString& string);
- FW_CString& operator=(const FW_Char* string);
-
- virtual FW_ByteCount GrowCapacity(FW_ByteCount capacityNeeded);
- // Return tCapacity*sizeof(FW_Char). The capacity of bounded strings never changes.
-
- private:
- FW_ByteCount fStringSize;
- };
-
- //========================================================================================
- // CLASS FW_CString32
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CString32 : public FW_CBoundedString
- {
- public:
-
- FW_DECLARE_CLASS
-
- virtual ~ FW_CString32();
- FW_CString32();
- FW_CString32(const FW_CString32 &string);
- FW_CString32(const FW_CString &string);
- FW_CString32(const FW_Char *items, FW_CharacterCount numberItems);
- FW_CString32(const FW_Char *items);
- FW_CString32(FW_ByteCount charWidth);
-
- FW_CString& operator=(const FW_CString32 &string);
-
- private:
- FW_Byte fStorage[32 * sizeof(FW_Char) + FW_kMedianCharacterSize];
- // Must leave room for a NUL word
- };
-
- //========================================================================================
- // CLASS FW_CString255
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CString255 : public FW_CBoundedString
- {
- public:
-
- FW_DECLARE_CLASS
-
- virtual ~ FW_CString255();
- FW_CString255();
- FW_CString255(const FW_CString255 &string);
- FW_CString255(const FW_CString &string);
- FW_CString255(const FW_Char *items, FW_CharacterCount numberItems);
- FW_CString255(const FW_Char *items);
- FW_CString255(FW_ByteCount charWidth);
-
- FW_CString& operator=(const FW_CString255 &string);
-
- private:
- FW_Byte fStorage[255 * sizeof(FW_Char) + FW_kMedianCharacterSize];
- // Must leave room for a NUL word
- };
-
- //========================================================================================
- // CLASS FW_CBoundedString inlines
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_CBoundedString::operator=
- //----------------------------------------------------------------------------------------
-
- inline FW_CString& FW_CBoundedString::operator=(const FW_CString& string)
- {
- fCharWidth = string.GetCharWidth();
- ReplaceAll(string);
- return *this;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CBoundedString::operator=
- //----------------------------------------------------------------------------------------
-
- inline FW_CString& FW_CBoundedString::operator=(const FW_Char* string)
- {
- ReplaceAllBytes(string, FW_StringLength(string));
- return *this;
- }
-
- //========================================================================================
- // CLASS FW_CString32 inlines
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_CString32::operator=
- //----------------------------------------------------------------------------------------
-
- inline FW_CString& FW_CString32::operator=(const FW_CString32& string)
- {
- if (&string != this)
- {
- fCharWidth = string.GetCharWidth();
- ReplaceAll(string);
- }
- return *this;
- }
-
- //========================================================================================
- // CLASS FW_CString255 inlines
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_CString255::operator=
- //----------------------------------------------------------------------------------------
-
- inline FW_CString& FW_CString255::operator=(const FW_CString255& string)
- {
- if (&string != this)
- {
- fCharWidth = string.GetCharWidth();
- ReplaceAll(string);
- }
- return *this;
- }
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export off
- #endif
-
- #endif
-